import { baseRequestClient, requestClient } from '#/api/request';

// http://192.168.2.136:8090/ChargeSystem/plan/getVillageList
// 小区树形结构
export async function getVillageList() {
  return requestClient.get(`/ChargeSystem/plan/getVillageList`);
}

// 热站树形结构 // getHeatExchangeList
export async function getHeatExchangeList() {
  return requestClient.get(`/ChargeSystem/plan/getHeatExchangeList`);
}
// 选择树结构返回表格   getPlanList
export async function getPlanList(data: any) {
  return baseRequestClient.post(`/ChargeSystem/plan/getPlanList`, data, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
}
// 表格合计列getSumPlan
export async function getSumPlan(data: any) {
  return requestClient.get(
    `/ChargeSystem/plan/getSumPlan?${data.villageIds != undefined ? 'villageIds' : 'heatExchangeIds'}=${data.villageIds != undefined ? data.villageIds : data.heatExchangeIds}&year=${data.year}&status=${data.status}&isVillageOrHeatExchange=${data.isVillageOrHeatExchange}`,
  );
}
// 修改submitUpdateExamine
export async function submitUpdateExamine(data: any) {
  return baseRequestClient.post(`/ChargeSystem/plan/submitUpdateExamine`, data);
}
// 新增insertPlan
export async function insertPlan(data: any) {
  return baseRequestClient.post(`/ChargeSystem/plan/insertPlan`, data);
}
// 删除submitDeleteExamine
export async function submitDeleteExamine(data: any) {
  return baseRequestClient.post(
    `/ChargeSystem/plan/submitDeleteExamine?id=${data}`,
  );
}
// 操作记录查询getRecordByVillageId
export async function getRecordByVillageId(data: any) {
  return requestClient.get(
    `/ChargeSystem/plan/getRecordByVillageId?id=${data.id}&page=${data.page}&limit=${data.limit}`,
  );
}
// 编辑上传文件/ChargeSystem/file/uploadAttachment
export async function uploadAttachment(data: any) {
  return baseRequestClient.post(`/ChargeSystem/file/uploadAttachment`, data, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
}
// 采暖季应收计划-批量导出生成接口  ChargeSystem/file/exportFile
export async function exportFile(data: any) {
  return baseRequestClient.get(
    `/ChargeSystem/file/exportFile?${data.villageIds != undefined ? 'villageIds' : 'heatExchangeIds'}=${data.villageIds != undefined ? data.villageIds : data.heatExchangeIds}&year=${data.year}&status=${data.status}&isVillageOrHeatExchange=${data.isVillageOrHeatExchange}`,
  );
}

//  采暖季应收计划-批量导入接口  ChargeSystem/file/upload
export async function upload(data: any) {
  return baseRequestClient.post(`/ChargeSystem/file/upload`, data, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
}

//  采暖季应收计划-批量导入接口-附件  ChargeSystem/file/upload
export async function uploadAttachmentFile(data: any) {
  return baseRequestClient.post(`/ChargeSystem/file/uploadAttachment`, data, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
}

//  采暖季应收计划-导出历史||导入历史   表格 getExcelHistory
export async function getExcelHistory(data: any) {
  return baseRequestClient.get(
    `/ChargeSystem/file/getExcelHistory?type=${data.type}&page=${data.page}&limit=${data.limit}`,
  );
}
